<?xml version="1.0" encoding="UTF-8"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1">
<jsp:directive.page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" />
<jsp:directive.page import="java.util.ArrayList, java.util.Iterator, cult.ticketing.bean.*" />
<jsp:output omit-xml-declaration="no" doctype-root-element="html" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" />
<jsp:include page="templates/include_header.html" />

<jsp:text><![CDATA[<html>
<head>
<title>Cult Ticketing System</title>

<script type="text/javascript">
    function purchaseByCreditCard() {
        document.getElementById('costSummary').action += '/jsp/payByCreditCard.jsp';
        document.getElementById("costSummary").submit();
    }

    function purchaseByLoyaltyPoint() {
        document.getElementById('costSummary').action += '/index.do';
        document.getElementById('costSummary').todo.value = 'purchaseByLoyaltyPoint';
        document.getElementById("costSummary").submit();
    }

    function officerPurchase() {
        document.getElementById('costSummary').action += '/jsp/officerPurchase.jsp';
        document.getElementById("costSummary").submit();
    }
</script>

<link href="]]></jsp:text><jsp:expression>request.getContextPath()</jsp:expression><jsp:text><![CDATA[/css/style.css" rel="stylesheet" type="text/css" />
<link href="]]></jsp:text><jsp:expression>request.getContextPath()</jsp:expression><jsp:text><![CDATA[/css/movie.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="container">
]]></jsp:text>
<jsp:include page="templates/include_menu.jsp" />
<jsp:text><![CDATA[<div id="main">
        <div id="content">
        <div id="head_image">
        	<div id="slogan"><strong>Cult Ticketing System -- Cost Summary</strong><br />
       	    </div>
            <div id="under_slogan_text">
                <br /><br /><br /><br />

            </div>
          </div>

         <div id="left">]]></jsp:text>
            <jsp:include page="templates/login.jsp" />
            <jsp:include page="templates/calendar.jsp" />
         <jsp:text><![CDATA[</div>

         <div id="right">
            <h1>Cost Summary</h1>
            <p>&nbsp;</p>]]></jsp:text>

        <jsp:text><![CDATA[
            <form name="costSummary" id="costSummary" method="post" action="]]></jsp:text><jsp:expression>request.getContextPath()</jsp:expression><jsp:text><![CDATA[">
                Your total cost is: ]]></jsp:text><jsp:expression>session.getAttribute("totalCost")</jsp:expression><jsp:text><![CDATA[ <br />
            <input type="hidden" id="todo" name="todo" value="" />]]></jsp:text>
            <jsp:scriptlet>
            if (session.getAttribute("role") != null &amp;&amp; ((String)session.getAttribute("role")).equalsIgnoreCase("officer")) {</jsp:scriptlet>
                    <jsp:text><![CDATA[<input type="button" value="Purchase" onclick="officerPurchase()"/>]]></jsp:text>
            <jsp:scriptlet>}
            else {</jsp:scriptlet>
                <jsp:text><![CDATA[
                    <input type="button" value="Purchase by Credit Card" onclick="purchaseByCreditCard()"/>
                ]]></jsp:text>
            <jsp:scriptlet>} </jsp:scriptlet>
            

        <jsp:scriptlet>
            if (session.getAttribute("loyaltyPoint") != null) {
                if ((Boolean)request.getAttribute("isEnoughLoyaltyPoint")) {</jsp:scriptlet>
                    <jsp:text><![CDATA[<input type="button" value="Purchase by Loyaty Point" onclick="purchaseByLoyaltyPoint()"/>
                    You have ]]></jsp:text><jsp:expression>session.getAttribute("loyaltyPoint")</jsp:expression><jsp:text><![CDATA[ loyalty point, enough for this purchase.]]></jsp:text>
                <jsp:scriptlet>}
                else {</jsp:scriptlet>
                    <jsp:text><![CDATA[<input type="button" value="Purchase by Loyaty Point" disabled="disabled"/>
                    You have ]]></jsp:text><jsp:expression>session.getAttribute("loyaltyPoint")</jsp:expression><jsp:text><![CDATA[ loyalty point, not enough for this purchase.]]></jsp:text>
                <jsp:scriptlet>}
            }
        </jsp:scriptlet>

        <jsp:text><![CDATA[
            </form>

        </div>
	</div>
</div>
</div>]]></jsp:text>
<jsp:include page="templates/include_footer.html" />
<jsp:text><![CDATA[</body>
</html>
]]></jsp:text>
</jsp:root>
